//
//  XYMapManager.m
//  Zhihuijinfu
//
//  Created by XY Lv on 17/3/24.
//  Copyright © 2017年 王笛. All rights reserved.
//

#import "XYMapManager.h"
#define DefaultLocationTimeout  6
#define DefaultReGeocodeTimeout 3
@implementation XYMapManager
+ (XYMapManager *)shareManager{
    
    static XYMapManager * xyManager = nil;
    static dispatch_once_t predict;
    dispatch_once(&predict, ^{
        xyManager = [[self alloc]init];
    });
    return xyManager;
    
}

- (instancetype)init{
    self = [super init ];
    if(self){
        [self configLocationManager];

    }
    return self;
}

- (void)configLocationManager
{
    self.locationManager = [[AMapLocationManager alloc] init];
    
    [self.locationManager setDelegate:self];
    
    //设置期望定位精度
    [self.locationManager setDesiredAccuracy:kCLLocationAccuracyHundredMeters];
    
    //设置不允许系统暂停定位
    [self.locationManager setPausesLocationUpdatesAutomatically:NO];
    
    //设置允许在后台定位
    [self.locationManager setAllowsBackgroundLocationUpdates:YES];
    
    //设置定位超时时间
    [self.locationManager setLocationTimeout:DefaultLocationTimeout];
    
    //设置逆地理超时时间
    [self.locationManager setReGeocodeTimeout:DefaultReGeocodeTimeout];
}

@end
